<?php
/**
 * Created by PhpStorm.
 * User: yeluojun
 * Date: 14-5-10
 * Time: 下午4:07
 */
require_once 'PHPUnit\Framework\TestCase.php';
include_once  dirname(__FILE__) .'/../../common/dbConn.php';
include_once dirname(__FILE__) . '/../selectRecord.php';
//require_once '../../common/dbConn.php';
include_once  dirname(__FILE__) .'/../../common/common.php';
class test_selectRecord extends PHPUnit_Framework_TestCase{
    protected function setUp()
    {
        parent::setUp();
        $q_pdo=connectDatabase();
        $initSql="INSERT INTO t_inauguration_record (USER_ID,I_COMPANY,COMPANY_ADDRESS,IN_DATE,OUT_DATE,POSITION,AWARD) VALUES (1000001, '测试公司','测试公司地址', '测试时间1','测试时间2', 1,1)";
        $q_pdo->exec($initSql);
        // TODO Auto-generated getUsersTest::setUp()
    }

    function testSelectRecord(){
//        try{
            $arg_req =  array("user_id2"=>"");
            $res = selectRecord($arg_req);
            $expect =  array("IsSuccess"=>false,"Msg"=>"user_id为空","data"=>null,"status"=>"error");
            $this->assertEquals($expect,$res,"user_id为空");


            $arg_req =  array("user_id"=>"");
            $res = selectRecord($arg_req);
            $expect =  array("IsSuccess"=>false,"Msg"=>"user_id错误","data"=>null,"status"=>"error");
            $this->assertEquals($expect,$res,"user_id错误");


            $arg_req =  array("user_id"=>"12412s");
            $res = selectRecord($arg_req);
            $expect =  array("IsSuccess"=>false,"Msg"=>"user_id错误","data"=>null,"status"=>"error");
            $this->assertEquals($expect,$res,"user_id错误");


            $arg_req =  array("user_id"=>"1000001");
            $res = selectRecord($arg_req);
            $expect =  true;
            $this->assertEquals($expect,$res["IsSuccess"],"操作成功");

        $s = "";
//        }catch ( Exception $e){
//          throw new Exception($e);
//        }

    }

    protected function tearDown()
    {
        // TODO Auto-generated getUsersTest::tearDown()
        parent::tearDown();
        $q_pdo=connectDatabase();
        $initSql="delete from t_inauguration_record where user_id= 1000001";
        $q_pdo->exec($initSql);
    }





}